//https://www.nowcoder.com/practice/59ac416b4b944300b617d4f7f111b215?tpId=13&tqId=23249&ru=/exam/oj/ta&qru=/ta/coding-interviews/question-ranking&sourceUrl=%2Fexam%2Foj%2Fta%3FtpId%3D13
//位运算实现：异或、与的使用；

#include <limits>
#include <vector>
#include <math.h>

using namespace std;

class Solution {
  public:
    int Add(int num1, int num2) {
        int sum, carry;
        do {
            //记下不进位的数值和
            sum = num1 ^ num2;
            //记下进位的数值
            carry = (num1 & num2) << 1;
            num1 = sum;
            num2 = carry;
        } while (num2);
        return num1;
    }
};